<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui">
    
    <h:head>
        <title>Meteocal | Update profile</title>
        <h:outputStylesheet name="css/style.css" />
    </h:head>
    
    <h:body>
        <div id="container">
            
            <div id="sidebar">
                <h:form>
                    <p:poll interval="15" listener="#{notificationCheckBean.check()}" />
                    <p:menu model="#{menuBean.model}" style="min-height: 615px;"/>
                </h:form>                      
            </div>

            <div id="content" style="text-align: center; font-size: 18px;">
                <h:form id="registrationform">
                <p:panel styleClass="default" style="min-height: 600px;">
                <h:panelGrid columns="3" id="regGrid" style="font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; text-align: left; padding: 30px; margin-left: auto; margin-right: auto;">
                    <p:growl id="messages"  life="7000" showDetail="true" globalOnly="true" autoUpdate="true"/>
                    <h:outputLabel for="name">First name:</h:outputLabel>
                    <p:inputText id="name" value="#{userBean.user.name}">
                        <p:ajax update="namemsg"/>
                    </p:inputText>
                    <p:message id="namemsg" for="name" />
                    
                    <h:outputLabel for="surname">Last name:</h:outputLabel>
                    <p:inputText id="surname" value="#{userBean.user.surname}">
                        <p:ajax update="surnamemsg"/>
                    </p:inputText>
                    <p:message id="surnamemsg" for="surname" />
                    
                    <h:outputLabel for="city">City:</h:outputLabel>
                    <p:inputText id="city" value="#{userBean.user.city}">
                        <p:ajax update="citymsg"/>
                    </p:inputText>
                    <p:message id="citymsg" for="city" />
                     
                    <h:outputLabel for="email">Email address:</h:outputLabel>
                    <p:inputText id="email" value="#{userBean.email}" readonly="true">
                    </p:inputText>
                    <br/>
                    <h:outputLabel for="password">New password:</h:outputLabel>
                    <p:password  required="false" id="password" value="#{userBean.password1}"
                                feedback="true" match="pwd2" />
                    <br/>
                    <h:outputLabel for="pwd2">Confirm password:</h:outputLabel>
                    <p:password id="pwd2" label="Confirm password"/>
                </h:panelGrid>
                <br/><br/>
                <p:button id="cancel" value="CANCEL" outcome="home" style="alignment-adjust: central" icon="ui-icon-closethick"/>
                &nbsp; &nbsp;
                <p:commandButton value="SAVE" update="regGrid"  style="alignment-adjust: central" icon="ui-icon-check" action="#{userBean.modifyUser()}"/>
                <br/><br/>
                </p:panel>
                </h:form>
            </div>
        </div>
    </h:body>
    
</html>